package com.moxiao.yfjh.module.blind.dal.mysql.memberMessage;

import com.moxiao.yfjh.module.blind.controller.admin.memberMessage.vo.MemberMessageExportReqVO;
import com.moxiao.yfjh.module.blind.controller.admin.memberMessage.vo.MemberMessagePageReqVO;
import com.moxiao.yfjh.module.blind.dal.dataobject.memberMessage.MemberMessageDO;
import java.util.*;

import com.moxiao.yfjh.framework.common.pojo.PageResult;
import com.moxiao.yfjh.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.moxiao.yfjh.framework.mybatis.core.mapper.BaseMapperX;
import org.apache.ibatis.annotations.Mapper;
import com.moxiao.yfjh.module.blind.controller.admin.memberMessage.vo.*;

/**
 * 相亲聊天记录 Mapper
 *
 * @author mx
 */
@Mapper
public interface MemberMessageMapper extends BaseMapperX<MemberMessageDO> {

    default PageResult<MemberMessageDO> selectPage(MemberMessagePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MemberMessageDO>()
                .eqIfPresent(MemberMessageDO::getRecordId, reqVO.getRecordId())
                .eqIfPresent(MemberMessageDO::getSendMemId, reqVO.getSendMemId())
                .eqIfPresent(MemberMessageDO::getReciveMemId, reqVO.getReciveMemId())
                .eqIfPresent(MemberMessageDO::getMessageType, reqVO.getMessageType())
                .eqIfPresent(MemberMessageDO::getMessageContent, reqVO.getMessageContent())
                .eqIfPresent(MemberMessageDO::getMessageStatus, reqVO.getMessageStatus())
                .betweenIfPresent(MemberMessageDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MemberMessageDO::getMessageId));
    }

    default List<MemberMessageDO> selectList(MemberMessageExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<MemberMessageDO>()
                .eqIfPresent(MemberMessageDO::getRecordId, reqVO.getRecordId())
                .eqIfPresent(MemberMessageDO::getSendMemId, reqVO.getSendMemId())
                .eqIfPresent(MemberMessageDO::getReciveMemId, reqVO.getReciveMemId())
                .eqIfPresent(MemberMessageDO::getMessageType, reqVO.getMessageType())
                .eqIfPresent(MemberMessageDO::getMessageContent, reqVO.getMessageContent())
                .eqIfPresent(MemberMessageDO::getMessageStatus, reqVO.getMessageStatus())
                .betweenIfPresent(MemberMessageDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MemberMessageDO::getMessageId));
    }


    public MemberMessageDO selectPageByUserId(MemberMessagePageReqVO reqVO);
//    {
//        return selectPage(reqVO, new LambdaQueryWrapperX<MemberMessageDO>()
//                .eq(MemberMessageDO::getReciveMemId, reqVO.getMemberId())
//                .or().eq(MemberMessageDO::getSendMemId,reqVO.getMemberId())
//                .eq(MemberMessageDO::getRecordId,reqVO.getRecordId())
//                .orderByDesc(MemberMessageDO::getCreateTime));
//    }
//    {
//        return selectPage(reqVO, new LambdaQueryWrapperX<MemberMessageDO>()
//                .eqIfPresent(MemberMessageDO::getRecordId, reqVO.getMemberId())
//                .eqIfPresent(MemberMessageDO::getReciveMemId, reqVO.getReciveMemId())
//                .eqIfPresent(MemberMessageDO::getMessageType, reqVO.getMessageType())
//                .eqIfPresent(MemberMessageDO::getMessageContent, reqVO.getMessageContent())
//                .eqIfPresent(MemberMessageDO::getMessageStatus, reqVO.getMessageStatus())
//                .betweenIfPresent(MemberMessageDO::getCreateTime, reqVO.getCreateTime())
//                .orderByDesc(MemberMessageDO::getMessageId));
//    }

}
